home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 76 / DVD Actual 1 Marzo 2003.iso / Trial / TurboCAD 7.1 Pro / Data.Cab / F24758_WSetup.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-11-10  |  2.9 KB  |  87 lines

  1. /******************************************************************/
  2. /*                                                                */
  3. /*                      TurboCAD for Windows                      */
  4. /*                   Copyright (c) 1993 - 1999                    */
  5. /*             International Microcomputer Software, Inc.         */
  6. /*                            (IMSI)                              */
  7. /*                      All rights reserved.                      */
  8. /*                                                                */
  9. /******************************************************************/
  10. // WSetup.cpp : implementation file
  11. //
  12.  
  13. #include "stdafx.h"
  14. #include "JPEG.h"
  15. #include "WSetup.h"
  16.  
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CJPEGWriteSetup dialog
  25.  
  26. // This is a trivial example of a settings UI dialog.  We store the width and height
  27. // of the desired JPEG image in two data members, that we access in our automation object.
  28.  
  29. const int nDefaultHeight = 128;
  30. const int nDefaultWidth = 128;
  31.  
  32. CJPEGWriteSetup::CJPEGWriteSetup(CWnd* pParent /*=NULL*/)
  33.     : CDialog(CJPEGWriteSetup::IDD, pParent)
  34. {
  35.     //{{AFX_DATA_INIT(CJPEGWriteSetup)
  36.     m_nHeight = nDefaultHeight;
  37.     m_nWidth = nDefaultWidth;
  38.     //}}AFX_DATA_INIT
  39. }
  40.  
  41.  
  42. void CJPEGWriteSetup::DoDataExchange(CDataExchange* pDX)
  43. {
  44.     CDialog::DoDataExchange(pDX);
  45.     //{{AFX_DATA_MAP(CJPEGWriteSetup)
  46.     DDX_Text(pDX, IDC_JPEG_HEIGHT, m_nHeight);
  47.     DDV_MinMaxUInt(pDX, m_nHeight, 1, 1024);
  48.     DDX_Text(pDX, IDC_JPEG_WIDTH, m_nWidth);
  49.     DDV_MinMaxUInt(pDX, m_nWidth, 1, 1024);
  50.     //}}AFX_DATA_MAP
  51. }
  52.  
  53.  
  54. BEGIN_MESSAGE_MAP(CJPEGWriteSetup, CDialog)
  55.     //{{AFX_MSG_MAP(CJPEGWriteSetup)
  56.         // NOTE: the ClassWizard will add message map macros here
  57.     //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59.  
  60. static const TCHAR szJPEGFilter[] = _T("JPEG_Filter");
  61. static const TCHAR szWidth[] = _T("Height");
  62. static const TCHAR szHeight[] = _T("Width");
  63.  
  64. // Retrieve settings from the specified INI file.
  65. // We use a (hopefully) unique section name to store our data.
  66.  
  67. void CJPEGWriteSetup::FromProfile(LPCTSTR szProfile)
  68. {
  69.     m_nWidth = ::GetPrivateProfileInt(szJPEGFilter, szWidth, nDefaultWidth, szProfile);
  70.     m_nHeight = ::GetPrivateProfileInt(szJPEGFilter, szHeight, nDefaultHeight, szProfile);
  71. }
  72.  
  73. // Save settings to the specified INI file.
  74. // We use a (hopefully) unique section name to store our data.
  75.  
  76. void CJPEGWriteSetup::ToProfile(LPCTSTR szProfile)
  77. {
  78.     TCHAR szBuf[32];
  79.     _itot(m_nWidth, szBuf, 10);
  80.     ::WritePrivateProfileString(szJPEGFilter, szWidth, szBuf, szProfile);
  81.     _itot(m_nHeight, szBuf, 10);
  82.     ::WritePrivateProfileString(szJPEGFilter, szHeight, szBuf, szProfile);
  83. }
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CJPEGWriteSetup message handlers
  87.